<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
	body{
		padding: 0;
		margin: 0;
	}
		#box{
			width: 200px;
			height: 200px;
			border-radius: 50%;
			background-color: red;
			position: absolute;
			left: 0
		}

		#box1{
			width: 200px;
			height:500px;
			background-color: #666;
			position: absolute;
			top:30%;
			left: -200px;
		}
		#box1 span{
			display: block;
			width: 20px;
			height: 80px;
			line-height: 20px;
			background-color: #000;
			position: absolute;
			top:0px;
			color: #fff;
			right: -20px;
		}
	</style>
    <script type="text/javascript">
        var timer = 'null';
    	function startMove(){
    		var box=document.getElementById('box');
            clearInterval(timer); //关闭以前的定时器。保证每次都执行一个定时器
              timer = setInterval(function(){
                  var spped=10;
                  if (box.offsetLeft>=500) {
                      clearInterval(timer);
                  }else{
                  	box.style.left=box.offsetLeft+spped+'px';
                  };
                   
              },30);


     }


    function startLeftNav(speed,iTarget){
        
        var box1=document.getElementById('box1');
        clearInterval(timer); //关闭以前的定时器。保证每次都执行一个定时器
        timer = setInterval(function(){

                  if (box1.offsetLeft==iTarget) {
                      clearInterval(timer);
                  }else{
                  	box1.style.left=box1.offsetLeft+speed+'px';
                  };
                   
              },30);

    }



    window.onload=function(){
      var box1=document.getElementById('box1');
      
      box1.onmouseover=function(){
      	 startLeftNav(50,0);
      };
   
      box1.onmouseout=function(){
      	 startLeftNav(-50,-200);
      };

    }


    </script>
</head>
<body>
	<input type="button" id="btn1" value="走" onclick="startMove()">
	<div id="box">
	</div>
	<div id="box1">
		<span>左侧导航</span>
	</div>
</body>
</html>